package sfmc.biz.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import sfmc.biz.dao.SfmcCustStatusDao;
import sfmc.biz.service.SfmcCustStatusService;
import sfmc.biz.vo.Sfmc_TB_CUSTSTATUS;

@Service("SfmcCustStatusService")
public class SfmcCustStatusServiceImpl implements SfmcCustStatusService{
	
	protected Log log = LogFactory.getLog(this.getClass());
	
	@Resource(name="SfmcCustStatusDao")
	private SfmcCustStatusDao sfmcCustStatusDao;
	public void setSfmcCustStatusDao(SfmcCustStatusDao sfmcCustStatusDao) {
		this.sfmcCustStatusDao = sfmcCustStatusDao;
	}
	
	@Override
	public List<Sfmc_TB_CUSTSTATUS> getCustStatusList(Sfmc_TB_CUSTSTATUS sfmc_TB_CUSTSTATUS) {
		
		String where = "";
		
		try{
			if(!"".equals(sfmc_TB_CUSTSTATUS.getSearchCustName())){
				where += "AND B.CustName LIKE '%"+sfmc_TB_CUSTSTATUS.getSearchCustName()+"%'\n";
			}
			if(!"".equals(sfmc_TB_CUSTSTATUS.getSearchCustPhone())){
				where += "AND B.CustPhone LIKE '%"+sfmc_TB_CUSTSTATUS.getSearchCustPhone()+"%'\n";
			}
			System.out.println("where : "+where); 
			sfmc_TB_CUSTSTATUS.setWhere(where);
			return sfmcCustStatusDao.getCustStatusList(sfmc_TB_CUSTSTATUS);
			
		}catch(Exception e){
			log.fatal(e.getMessage());
			log.error(e.getStackTrace());
			return null;
		}
		
		
		
		/*WHERE SUBSTR(A.ORDDATE, 1, 8) between '20130801' and '20131023'
		AND B.CustName LIKE '%%'
		AND B.CustPhone LIKE '%%'*/
		//return sfmcCustStatusDao.getEmpList(sfmc_TB_CUSTSTATUS);
	}




}
